﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Master : System.Web.UI.MasterPage
{

    public string backgroudImage = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] != null)
        {
            divLogin.Visible = false;
        }
        else
        {
            divIndex.Visible = false;
        }
        BindBackGroud();
    }


    public void BindBackGroud()
    {
        if (Session["user"] != null)
        {
            Model.User u = Session["user"] as Model.User;
            if (u != null)
            {
                Model.PageSetup page = new BLL.PageSetup().GetModelBystrWhere("userid=" + u.ID);
                if (page != null && System.IO.File.Exists(Server.MapPath(page.HomeBackground)))
                {
                    backgroudImage = string.Format(" style=\"background:url({0});\" ", page.HomeBackground);
                }
            }
        }
    }
}
